package com.ccrego.haiyi.account.login;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;

import com.ccrego.haiyi.R;
import com.pachong.android.baseuicomponent.activity.BaseActivity;

import butterknife.Bind;

public class AgreementActivity extends BaseActivity {

    @Bind(R.id.wv_agreement)
    WebView mWvAgreement;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        initToolsBar();
        hideToolbar();
        setOnBackClickListener();
        //实例化WebView对象
        mWvAgreement = new WebView(this);
        //设置WebView属性，能够执行Javascript脚本
        mWvAgreement.getSettings().setJavaScriptEnabled(true);
        //加载需要显示的网页
        mWvAgreement.loadUrl("http://haiyi.xmappservice.com/#/protocol");
        //设置Web视图
        setContentView(mWvAgreement);
    }
//
    private void setOnBackClickListener() {
        findView(R.id.iv_back).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

    private void initToolsBar() {
        setTitle(R.string.agree);
        getCustomToolbar().addLeftImageButton(R.mipmap.icon_back1, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

    public static void start(Activity activity) {
        Intent intent = new Intent(activity, AgreementActivity.class);
        activity.startActivity(intent);
    }

    @Override
    public View createDataView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return inflater.inflate(R.layout.activity_agreement, null);

    }
}
